package com.h3c.nem.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

import javax.persistence.Column;
import javax.persistence.Table;
import java.util.Date;

/**
 * @author z22968
 * @date 2022/6/8 16:37
 */
@Data
@Table(name = "tb_care_notice_setting")
public class TbCareNoticeSetting {
    @TableId(type = IdType.AUTO)
    private String id;

    // 类型
    @Column(name = "type")
    private SettingType type;

    // 名称
    @Column(name = "name")
    private String name;

    // int值
    @Column(name = "value")
    private Integer value;

    // 文本值
    @Column(name = "text_value")
    private String textValue;

    // 创建人
    @Column(name = "created_by")
    @TableField(fill = FieldFill.INSERT)
    private String createdBy;

    // 创建时间
    @Column(name = "created_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="Asia/Shanghai")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    // 更新人
    @Column(name = "update_by")
    @TableField(fill = FieldFill.UPDATE)
    private String updateBy;

    // 更新时间
    @Column(name = "update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="Asia/Shanghai")
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    @Getter
    @AllArgsConstructor
    public enum SettingType {
        FREQUENCY(0, "频率"),
        PEOPLE_NUM(1, "人数"),
        PRE_STATEMENT(2, "预设语句"),
        MAIL_CONTENT(3, "邮件文本"),
        WECHAT_CONTENT(4, "企微文本");

        @EnumValue
        private final Integer code;

        //    @JsonValue
        private final String name;
    }
}
